<?php
class ctrl_test extends ctrl_base
{
    private static $dirName = 'weixin';
    private static $access_token = '';

    public static function index(){
        $jssdk = new ctrl_jssdk(APPID,APPSECRET);
        $config = $jssdk->getSignPackage();
        //print_r($config);
        self::smarty() -> assign('config',$config);
        self::smarty() -> display('test.html');
    }
    
    public static function test(){
        $rand = model_oauth::rand_str(10);
        //$aa = model_user::resgiter('opasAjxQrSE_JU1AgARlTr3iR1Ak');
        $a = "<a href='http://gongqinglu.wap.5.stg2.24money.com/?act=weixin_weixin&st=oauth&v=".$rand."'>oauth2.0网页授权</a>-----------";
        $a .= "<a href='http://mp.weixin.qq.com/s?__biz=MjM5ODE4MzgyOQ==&mid=200190768&idx=1&sn=4911cbad05544b2a849a18fd51c30174#rd&v=".$rand."'>点击弹出关注页面</a>----------";
        $a .= "<a href='http://gongqinglu.wap.5.stg2.24money.com/?act=weixin_weixin&st=share&v=".$rand."'>点击分享</a>";
        $aa = model_send::send_text('opasAjxQrSE_JU1AgARlTr3iR1Ak',$a);
        var_dump($aa);
        //self::smarty()->display('error/wx_error.html');
    }
    
    public static function tetx(){
        $a = ' http://wx.qlogo.cn/mmopen/50HcP4UOeLVN4VjESiapz6TPibIhGAbqBqmvxvJntcTsaVaTVc7HuhO3Df6vd6mQeUlaQVxZSLcSwcQkdKj3iactjjHooaBVmIb/0';
        echo model_weixin::headimg($a,46);
    }
    
    public static function get_access(){
        echo model_weixin::get_access_token();
    }
    
 
    public static function get_form() {
    	$data = $_POST['Data'];
    	var_dump($data);
    	framework_static_function::write_log(json_encode($_POST),'form_data');
    	framework_static_function::write_log($data,'form_data');
    	
    }
    
    public static function test_send_text() {
    	$url = HOST_URL."/?act=api&st=send_text";
    	$data = array(
    		'touser' => 'o-w6St-fdCFF7LTT8pOlKx6Jx4xY',
    		'content' => '我是个测试文本\t\r\n我测试一下这个格式是不是正确。',
    	);
    	$postData['message'] = json_encode($data);
    	$res = model_weixin::http_post($url, $postData);
    	var_dump($res);
    }
    
}
